<template>
	<!-- 设施信息 -->
	<view class="facility-container">
		<view class="info">
			<view>
				<view class="info-item" @click="onEdit(item)" v-for="item in residentList" :key="item.id" >
					<!-- <view class="info-title">{{facilityType[item['设施类型']]}}
						<view class="status" v-if="item['设施状态'] == '1'">正常</view>
						<view class="status wrong" v-else>异常</view>
					</view> -->
					<view>
						<view class="info-wrap">姓名：{{item['姓名']}}</view>
						<view class="info-wrap">电话：{{item['手机号']}}</view>
						<view class="info-wrap">证件编号：{{item['证件编号']}}</view>
						<view class="info-wrap">与户主关系：{{residentTypeObj[item['户主关系']]}}</view>
					</view>
					<view class="arrow"></view>
					<!-- <view class="status">正常</view> -->
					<!-- <view class="status">异常</view> -->
					<view class="delete" v-if="isShowDelete" @click.stop="onDelete(item.id)">删除</view>
				</view> 
			</view>
			<!-- <view v-else class="empty">暂无设施</view> -->
		</view>
	</view>
</template>

<script>
	export default {
		// props: ['install-List'],
		props: {
			residentList: {
				required: true
			},
			isShowDelete: {
				type: Boolean,
				default: true
			}
		},
		// props: {
		// 	installList: {
		// 		type: [Array,Object],
		// 		required: true
		// 	}
		// },
		data() {
			return {
				facilityType: this.$type.facilityType,
				residentTypeObj: this.$type.residentTypeObj
			}
		},
		methods: {
			onAdd() {
				this.$emit('add')
			},
			onDelete(id) {
				this.$emit('delete', id)
			},
			onEdit(item) {
				uni.navigateTo({
					url: '/fireGridCheck/addResident/addResident?residentId=' + item.id + '&originId=' + item.检查点id
				})
				// this.$emit('edit', id)
			}
		}
	}
</script>

<style lang="scss" scoped>

// .title {
// 	padding: 0 14rpx;
// 	display: flex;
// 	align-items: center;
// 	justify-content: space-between;
// 	margin-bottom: 40rpx;
// 	font-size: 34rpx;
// 	.left {
// 		font-size: 32rpx;
// 		&:before {
// 			content: '';
// 			position: absolute;
// 			top: 24rpx;
// 			left: 24rpx;
// 			width: 6rpx;
// 			height: 34rpx;
// 			background-color: #5094FF;
// 		}
// 	}
// 	.right {
// 		// display: flex;
// 		.more {
// 			position: relative;
// 			font-size: 34rpx;
// 			color: #5094FF;
// 			margin-left: 20rpx;
// 			&:after {
// 				content: '';
// 				position: absolute;
// 				top: 14rpx;
// 				right: -16rpx;
// 				width: 16rpx;
// 				height: 16rpx;
// 				border-top: 2rpx solid #5094FF;
// 				border-right: 2rpx solid #5094FF;
// 				transform: rotate(45deg);
// 			}
// 		}
// 	}
// 	.add {
// 		font-size: 32rpx;
// 		font-weight: bold;
// 		color: #5094FF;
// 		margin-right: 10rpx;
// 	}
// }
.info {
	margin-left: 16rpx;
	// padding-bottom: 20rpx;
	// display: flex;
	// justify-content: center;
	// align-items: center;
	.empty {
		// width: 100%;
		display: flex;
		align-items: center;
		justify-content: center;
		height: 174rpx;
		color: #999;
	}
	.info-item {
		background-color: #fff;
		padding: 20rpx;
		position: relative;
		box-shadow: 0px 1px 6rpx 0px #EEEEEE;
		border-radius: 8rpx;
		margin-bottom: 20rpx;
		font-size: 32rpx;
		.info-title {
			margin-bottom: 10rpx;
			display: flex;
			font-size: 36rpx;
			align-items: center;
			.status {
				margin-top: 8rpx;
				margin-left: 34rpx;
				text-align: center;
				line-height: 35rpx;
				width: 80rpx;
				height: 35rpx;
				font-size: 22rpx;
				color: #1FAA56;
				border: 2rpx solid #1FAA56;
			}
			.wrong {
				color: red;
				border: 2rpx solid red;
			}
		}
		.info-wrap {
			line-height: 50rpx;
			font-size: 28rpx;
			width: 20em;
			overflow: hidden;
			white-space: nowrap;
			text-overflow: ellipsis;
		}
		.arrow {
			position: absolute;
			top: 100rpx;
			right: 40rpx;
			width: 20rpx;
			height: 20rpx;
			border-top: 2rpx solid #333;
			border-right: 2rpx solid #333;
			transform: rotate(45deg);
		}
		.delete {
			position: absolute;
			right: 30rpx;
			bottom: 30rpx;
			text-align: center;
			line-height: 45rpx;
			width: 90rpx;
			height: 45rpx;
			font-size: 24rpx;
			color: #E57544;
			border: 2rpx solid #E57544;
		}
	}
}
</style>
